
check_script_comments() {

    lexdir=../../../cache/lexer_scripts
    commentsdir=../../../cache/lexer_scripts/comments
    rm -rf $commentsdir
    if [ ! -d $lexdir ]; then
        mkdir $lexdir
    fi
    if [ ! -d $commentsdir ]; then
        mkdir $commentsdir
    fi
    script="$1"
    printf "script comments: %s " $script 
    xrnlib-cli --script $script > $commentsdir/$script.sh
    cat $commentsdir/$script.sh | grep '#' | grep -vi 'password' | head -n -9 | sed '1,2d' | awk '{ print $2 }' | sort > $commentsdir/$script.comments
    cat $commentsdir/$script.sh | grep -v '#' | grep -v 'decoding-conf' | grep -v 'encoding-conf' | grep -v 'arithmetic-conf' | grep -v 'sequence-conf' | grep -v 'permutation-conf' | grep -v 'logging-conf' | awk '/--/{ print $0 }' | sed 's/--//g' | awk '{ print $1 }' | sort | uniq > $commentsdir/$script.commands
    cmp --silent $commentsdir/$script.comments $commentsdir/$script.commands && printf 'PASS\n' 
    cmp --silent $commentsdir/$script.comments $commentsdir/$script.commands || printf 'FAIL\n' 

}

check_script_comments dump-encoding-param
check_script_comments decode-encode
check_script_comments mine-xmatrix-comp-rnd
check_script_comments mine-xmatrix-comp-ot
check_script_comments make-point
check_script_comments make-start-point
check_script_comments make-monovalent-key
check_script_comments make-commitment-binomial-key
check_script_comments make-commitment-sym-signature
check_script_comments make-commitment-sym-certificate
check_script_comments make-signature-symmetric
check_script_comments make-signature-asymmetric
check_script_comments make-certificate-symmetric
check_script_comments make-certificate-asymmetric
check_script_comments make-checksum
check_script_comments split-symmetric
check_script_comments encrypt-symmetric
check_script_comments encrypt-asymmetric
check_script_comments convert-hash-to-point
check_script_comments make-block
check_script_comments print-header
check_script_comments print-lib-info
check_script_comments make-ring-signature
check_script_comments make-steganography-block
check_script_comments make-steganography-raw

